package com.qidian.by.util.exceptions;

/**
 * @Author: CoolPro
 * @Description:
 * @Time: 2024-05-06 18:42
 **/
public enum ServiceExceptionEnum {
    /**
     * 默认异常
     */
    DEFAULT_EXCEPTION(500, "系统异常"),
    VERIFICATION_TOKEN_ERROR(401, "token校验失败"),
    VERIFICATION_CODE_HAS_EXPIRED(401, "验证码已失效"),
    VERIFICATION_FAILED(401, "验证码错误"),
    LOGIN_ERROR(401, "登录失败"),
    LOGIN_UNAUTHORIZED(401, "未登录"),
    /**
     * 默认成功
     */
    DEFAULT_SUCCESS(200, "成功"),
    PARAM_ERROR(400, "参数错误"),
    TYPE_MARK_REPEAT_ERROR(400, "类型标记重复"),
    /**
     * 默认失败
     */
    DEFAULT_FAIL(501, "分类已存在"),

    /**
     * 图片上传异常
     */
    IMAGE_UPLOAD_ERROR(400, "图片上传失败"),
    USERNAME_REPEAT(400, "用户已存在");
    private Integer code;
    private String message;

    ServiceExceptionEnum(Integer code, String message) {
        this.code = code;
        this.message = message;
    }

    public Integer getCode() {
        return code;
    }

    public void setCode(Integer code) {
        this.code = code;
    }

    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }

    @Override
    public String toString() {
        return "{" +
                "code=" + code +
                ", message='" + message + '\'' +
                '}';
    }
}
